.\"-
.\" Copyright (c) 2006 Verdens Gang AS
.\" Copyright (c) 2006 Linpro AS
.\" All rights reserved.
.\"
.\" Author: Dag-Erling Smørgrav <des@linpro.no>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: varnishlog.1 1458 2007-05-20 17:38:15Z des $
.\"
.Dd May 11, 2007
.Dt VARNISHLOG 1
.Os
.Sh NAME
.Nm varnishlog
.Nd Display Varnish logs
.Sh SYNOPSIS
.Nm
.Op Fl a
.Op Fl b
.Op Fl C
.Op Fl c
.Op Fl D
.Op Fl d
.Op Fl I Ar regex
.Op Fl i Ar tag
.Op Fl o
.Op Fl P Ar file
.Op Fl r Ar file
.Op Fl V
.Op Fl w Ar file
.Op Fl X Ar regex
.Op Fl x Ar tag
.Op Ar tag Ar regex
.Sh DESCRIPTION
The
.Nm
utility reads and presents
.Xr varnishd 1
shared memory logs.
.Pp
The following options are available:
.Bl -tag -width Fl
.It Fl a
When writing to a file, append to it rather than overwrite it.
.It Fl b
Include log entries which result from communication with a backend
server.
If neither
.Fl b
nor
.Fl c
is specified,
.Nm
acts as if they both were.
.It Fl C
Ignore case when matching regular expressions.
.It Fl c
Include log entries which result from communication with a client.
If neither
.Fl b
nor
.Fl c
is specified,
.Nm
acts as if they both were.
.It Fl D
Daemonize.
.It Fl d
Process old log entries on startup.
Normally,
.Nm
will only process entries which are written to the log after it
starts.
.It Fl I Ar regex
Include log entries which match the specified regular expression.
If neither
.Fl I
nor
.Fl i
is specified, all log entries are included.
.It Fl i Ar tag
Include log entries with the specified tag.
If neither
.Fl I
nor
.Fl i
is specified, all log entries are included.
.It Fl o
Group log entries by request ID.
This has no effect when writing to a file using the
.Fl w
option.
.It Fl P Ar file
Write the process's PID to the specified
.Ar file .
.It Fl r Ar file
Read log entries from
.Ar file
instead of shared memory.
.It Fl V
Display the version number and exit.
.It Fl w Ar file
Write log entries to
.Ar file
instead of displaying them.
The file will be overwritten unless the
.Fl a
option was specified.
.Pp
If
.Nm
receives a
.Dv SIGHUP
while writing to a file, it will reopen the file, allowing the old one
to be rotated away.
.It Fl X Ar regex
Exclude log entries which match the specified regular expression.
.It Fl x Ar tag
Exclude log entries with the specified tag.
.El
.Pp
If the
.Fl o
option was specified, an additional
.Ar tag
and
.Ar regex
may be specified to select only requests which generated a log entry
with the given
.Ar tag
whose contents match the given
.Ar regex .
.Sh TAGS
The following log entry tags are currently defined:
.\" keep in sync with include/shmlog_tags.h
.\" XXX add descriptions
.Bl -tag -width 16
.It Dv Backend
.It Dv BackendClose
.It Dv BackendOpen
.It Dv BackendReuse
.It Dv BackendXID
.It Dv CLI
.It Dv ClientAddr
.It Dv Debug
.It Dv Error
.It Dv ExpBan
.It Dv ExpKill
.It Dv ExpPick
.It Dv Hit
.It Dv HitPass
.It Dv HttpError
.It Dv HttpGarbage
.It Dv Length
.It Dv ObjHeader
.It Dv ObjLostHeader
.It Dv ObjProtocol
.It Dv ObjRequest
.It Dv ObjResponse
.It Dv ObjStatus
.It Dv ObjURL
.It Dv ReqEnd
.It Dv ReqStart
.It Dv RxHeader
.It Dv RxLostHeader
.It Dv RxProtocol
.It Dv RxRequest
.It Dv RxResponse
.It Dv RxStatus
.It Dv RxURL
.It Dv SessionClose
.It Dv SessionOpen
.It Dv StatAddr
.It Dv StatSess
.It Dv TTL
.It Dv TxHeader
.It Dv TxLostHeader
.It Dv TxProtocol
.It Dv TxRequest
.It Dv TxResponse
.It Dv TxStatus
.It Dv TxURL
.It Dv VCL_acl
.It Dv VCL_call
.It Dv VCL_return
.It Dv VCL_trace
.It Dv WorkThread
.El
.Sh EXAMPLES
The following command line simply copies all log entries to a log
file:
.Bd -literal -offset 4n
$ varnishlog -w /var/log/varnish.log
.Ed
.Pp
The following command line reads that same log file and displays
requests for the front page:
.Bd -literal -offset 4n
$ varnishlog -r /var/log/varnish.log -c -o RxURL '^/$'
.Ed
.Sh SEE ALSO
.Xr varnishd 1 ,
.Xr varnishhist 1 ,
.Xr varnishncsa 1 ,
.Xr varnishstat 1 ,
.Xr varnishtop 1
.Sh HISTORY
The
.Nm
utility was developed by
.An Poul-Henning Kamp Aq phk@phk.freebsd.dk
in cooperation with Verdens Gang AS and Linpro AS.
This manual page was written by
.An Dag-Erling Sm\(/orgrav Aq des@linpro.no .
